import request from '@utils/request'

// 查询postgres列表
export function getPostgres(params) {
  return request({
      url: `/business/sytdlz/list`,
      headers: {
        isToken: true,
        isEncrypt: true
      },
      method: 'get',
      params: params
  })
}

// 根据条件获取总面积
export function gettotalArea(params) {
  return request({
      url: `/business/sytdlz/getAreaTotal`,
      headers: {
        isToken: true,
        isEncrypt: true
      },
      method: 'get',
      params: params
  })
}

// 获取postgres详细信息
export function getPostgresInfo(id) {
  return request({
      url: `/business/sytdlz/`+id,
      headers: {
        isToken: true,
        isEncrypt: true
      },
      method: 'get',
  })
}

// 新增postgres
export function addPostgresInfo(data) {
  return request({
      url: `/business/sytdlz`,
      headers: {
        isToken: true,
        isEncrypt: false
      },
      method: 'POST',
      data: data
  })
}

// 修改postgres
export function putPostgresInfo(data) {
  return request({
      url: `/business/sytdlz`,
      headers: {
        isToken: true,
        isEncrypt: false
      },
      method: 'PUT',
      data: data
  })
}

// 删除postgres
export function detPostgresInfo(id) {
  return request({
      url: `/business/sytdlz/`+id,
      headers: {
        isToken: true,
        isEncrypt: false
      },
      method: 'DELETE',
  })
}

// 查询postgres的geojson
export function getGeojson(params) {
  return request({
      url: `/business/sytdlz/getGeojson/${params}`,
      headers: {
        isToken: true,
        isEncrypt: true
      },
      method: 'get',
      // params: params
  })
}

// 根据条件获取统计图表数据
export function getchartInfo(params) {
  return request({
      url: `/business/sytdlz/getSytdlzAreaVoList`,
      headers: {
        isToken: true,
        isEncrypt: true
      },
      method: 'get',
      params: params
  })
}

// 获取村镇级联表
export function getTownAndVillage() {
  return request({
      url: `/business/sytdlz/getTownAndVillage`,
      headers: {
        isToken: true,
        isEncrypt: true
      },
      method: 'get'
  })
}

// 导出excel
export function getExport(data) {
  return request({
      url: `/business/sytdlz/export`,
      headers: {
        isToken: true,
        isEncrypt: true
      },
      responseType: 'blob',
      method: 'post',
      data: data
  })
}